package com.humi.partner.front.web;
import com.humi.cloud.common.model.Result;
import com.humi.cloud.security.support.annotation.LoginAccess;
import com.humi.partner.front.model.partnerType.PartnerTypeListQueryResponse;
import com.humi.partner.front.service.FrontPartnerTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.concurrent.Callable;

/**
 * <pre>
 * @Auther: lishijie
 * @Date: 2019/10/24 10:03
 *   Ver   		Date                    Author               	 Detail
 *   ----------------------------------------------------------------------
 *   1.0     2019/10/24 10:03    lishijie@360humi.com        new file.
 * @Description:Codes
 * </pre>
 */
@RestController
@RequestMapping("/front/partner_type")
@Api(tags = "前台-伙伴类型", protocols = MediaType.APPLICATION_JSON_UTF8_VALUE)
class FrontPartnerTypeController {
    @Autowired
    FrontPartnerTypeService frontPartnerTypeService;

    @LoginAccess
    @GetMapping("/lib/list")
    @ApiOperation(value = "查询伙伴类型列表",notes ="伙伴类型",response = PartnerTypeListQueryResponse.class)
    public Callable<Result> getPartnerTypeLibPage( ){
        return () -> frontPartnerTypeService.getPertnerType();
    }

    @LoginAccess
    @GetMapping("/getApplyStatus")
    @ApiOperation(value = "判断申请类型", notes = "输入申请类型状态")
    public Callable<Result> getApplyStatus(@Valid @ApiParam("通过partnerTypeId判断") @RequestParam("partnerTypeId") String partnerTypeId) {
        return () ->  frontPartnerTypeService.getApplyStatus(partnerTypeId);
    }

}
